package com.spider.demo3stream;

import java.util.stream.Stream;

public class StreamDemo3 {
    public static void main(String[] args) {
        //目标：Stream流的常用方法
        Stream<String> stream = Stream.of("张三", "李四舅", "王五", "赵六", "张三", "王五");
        //去重
        //stream.distinct().forEach(System.out::println);
        //筛选
        //stream.filter(s -> s.startsWith("张")).forEach(System.out::println);
        //映射
        //stream.map(s -> s.length()).forEach(System.out::println);
        //合并流
        Stream<String> stream1 = Stream.of("张三", "李四舅", "王五", "赵六", "张三", "王五");
        Stream<String> stream2 = Stream.of("spider","carn","java","python");
        Stream<String> stream3 = Stream.concat(stream1, stream2);
        stream3.forEach(System.out::println);

    }
}
